<template>
  <div id="app">
    <h2>myMessage</h2>
    <my-button type="success" @click="showmessage">显示弹窗</my-button>
    <!-- <my-message></my-message> -->
    <h2>myDialog</h2>
    <button @click="isShow = true">弹框</button>
    <my-dialog top="200" width="60%" :visible.sync="isShow">
      <!-- 写了就是头部 -->
      <template #title>
        <my-alert :closable="false" type="warning">标题</my-alert>
      </template>
      <!-- 不写默认就是中间的 -->
      <template>
        <my-form label-width="200px">
          <my-form-item label="用户名">
            <my-input
              placeholder="开始输入内容吧"
              @blur="clickHandler"
              v-model="food"
            ></my-input>
          </my-form-item>
        </my-form>
      </template>
      <!-- 底部的插槽 -->
      <template #footer>
        <my-button type="success">登录</my-button>
      </template>
    </my-dialog>
    <h2>myFormItem</h2>
    <my-form label-width="200px">
      <my-form-item label="用户名">
        <my-input
          placeholder="开始输入内容吧"
          @blur="clickHandler"
          v-model="food"
        ></my-input>
      </my-form-item>
      <my-form-item label-width="400px" label="密码">
        <my-input
          placeholder="开始输入内容吧"
          @blur="clickHandler"
          v-model="food"
        ></my-input>
      </my-form-item>
      <my-form-item label="性别">
        <my-switch :value="isChecked" @input="isChecked = $event"></my-switch>
      </my-form-item>
      <my-form-item label="操作">
        <my-button @click.native="hclick" type="success">登录</my-button>
      </my-form-item>
    </my-form>
    <h2>mySwitch</h2>
    <my-switch :value="isChecked" @input="isChecked = $event"></my-switch>
    <h2>myInput</h2>
    <my-input
      placeholder="开始输入内容吧"
      @blur="clickHandler"
      v-model="food"
    ></my-input>
    <h2>myButton</h2>
    <my-button @click.native="hclick">点击按钮</my-button>
    <my-button @click.native="hclick" type="success">点击按钮</my-button>
    <my-button @click.native="hclick" type="primary">点击按钮</my-button>
    <h2>myLink</h2>
    <my-link></my-link>
    <my-link type="danger">顿健康</my-link>
    <my-link type="success" href="https://www.baidu.com">百度</my-link>
    <my-link type="warning" :underline="false">****</my-link>
    <h2>myalert</h2>
    <my-alert>这是第一个默认的alert</my-alert>
    <my-alert type="info">这是第二个alert</my-alert>
    <my-alert type="warning" :center="true">这是第二个alert</my-alert>
    <my-alert type="success">这是第二个alert</my-alert>
    <my-alert type="error" :closable="false">这是第二个alert</my-alert>
  </div>
</template>

<script>
export default {
  name: 'App',
  data () {
    return {
      food: '榴莲排骨汤',
      isChecked: false,
      isShow: false
    }
  },
  components: {},
  methods: {
    hclick () {
      console.log('123')
    },
    clickHandler () {
      console.log('点了按钮!!!')
    },
    showmessage () {
      this.$message({
        title: '你好吗',
        duration: 1000
      })
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* text-align: center; */
  color: #2c3e50;
  margin-top: 60px;
}
</style>
